package org.example.demo1.Entity;

import java.time.LocalDateTime;

public class VisitRecord {
    private Integer visit_id;       // 访问记录ID（主键）
    private Long user_id;          // 用户ID（外键）
    private Integer novel_id;      // 小说ID（外键）
    private Integer chapter_id;    // 章节ID（外键）
    private LocalDateTime visit_time; // 访问时间
    
    // 构造函数
    public VisitRecord() {
    }
    
    public VisitRecord(Long user_id, Integer novel_id, Integer chapter_id) {
        this.user_id = user_id;
        this.novel_id = novel_id;
        this.chapter_id = chapter_id;
        this.visit_time = LocalDateTime.now();
    }
    
    public VisitRecord(Integer visit_id, Long user_id, Integer novel_id, Integer chapter_id, LocalDateTime visit_time) {
        this.visit_id = visit_id;
        this.user_id = user_id;
        this.novel_id = novel_id;
        this.chapter_id = chapter_id;
        this.visit_time = visit_time;
    }
    
    // Getters and Setters
    public Integer getVisit_id() {
        return visit_id;
    }
    
    public void setVisit_id(Integer visit_id) {
        this.visit_id = visit_id;
    }
    
    public Long getUser_id() {
        return user_id;
    }
    
    public void setUser_id(Long user_id) {
        this.user_id = user_id;
    }
    
    public Integer getNovel_id() {
        return novel_id;
    }
    
    public void setNovel_id(Integer novel_id) {
        this.novel_id = novel_id;
    }
    
    public Integer getChapter_id() {
        return chapter_id;
    }
    
    public void setChapter_id(Integer chapter_id) {
        this.chapter_id = chapter_id;
    }
    
    public LocalDateTime getVisit_time() {
        return visit_time;
    }
    
    public void setVisit_time(LocalDateTime visit_time) {
        this.visit_time = visit_time;
    }
    
    @Override
    public String toString() {
        return "VisitRecord{" +
                "visit_id=" + visit_id +
                ", user_id=" + user_id +
                ", novel_id=" + novel_id +
                ", chapter_id=" + chapter_id +
                ", visit_time=" + visit_time +
                '}';
    }
}